package com.project.mapper;

import com.github.pagehelper.PageInfo;
import com.project.bean.LinkBean;
import lombok.experimental.Delegate;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author lyl
 * description:
 */
public interface ILinkMapper {
    /**
     * 添加
     *
     * @param linkBean
     */
    void add(LinkBean linkBean);


    /**
     * 删除
     *
     * @param linkId
     */
    @Delete("delete from t_link where pk_linkId = #{linkId}")
    void del(@Param("linkId") int linkId);

    /**
     * 根据id进行修改电话号码
     *
     * @param linkId
     * @param newTel
     */
    @Update("update t_link set l_tel = #{newTel} where pk_linkId = #{linkId}")
    void updateTel(@Param("linkId") int linkId, @Param("newTel") String newTel);

    /**
     * 查找
     *
     * @param linkId
     * @return
     */
    @Select("select * from t_link where pk_linkId = #{linkId}")
    @ResultMap("linkMap")
    LinkBean findById(@Param("linkId") int linkId);

    /**
     * 分页显示
     *
     * @return
     */
    @Select("select * from t_link")
    @ResultMap("linkMap")
    List<LinkBean> findAllByPage();
}
